/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demo.introduce;

import javax.swing.JOptionPane;

/**
 *
 * @author VANDH
 */
public class Dialog extends javax.swing.JFrame {

    /**
     * Creates new form Dialog
     */
    public Dialog() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
     * content of this method is always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnInputDialog = new javax.swing.JButton();
        btnRegisterDialog = new javax.swing.JButton();
        btnInputDialog2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("My Demo");

        btnInputDialog.setText("Open InputDialog");
        btnInputDialog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInputDialogActionPerformed(evt);
            }
        });

        btnRegisterDialog.setText("Open RegisterDialog");
        btnRegisterDialog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRegisterDialogActionPerformed(evt);
            }
        });

        btnInputDialog2.setText("Open OptionDialog");
        btnInputDialog2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInputDialog2ActionPerformed(evt);
            }
        });

        jLabel1.setText("jLabel1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnInputDialog)
                    .addComponent(btnRegisterDialog)
                    .addComponent(btnInputDialog2)
                    .addComponent(jLabel1))
                .addContainerGap(259, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnInputDialog)
                .addGap(18, 18, 18)
                .addComponent(btnInputDialog2)
                .addGap(18, 18, 18)
                .addComponent(btnRegisterDialog)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel1)
                .addContainerGap(159, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnInputDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInputDialogActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnInputDialogActionPerformed

    private void btnRegisterDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegisterDialogActionPerformed
        // TODO add your handling code here:
        // Modal dialog - true, Non-modal, modaless dialog
        RegisterDialog rd = new RegisterDialog(this, true);

        rd.setVisible(true);

        jLabel1.setText(String.valueOf(rd.getPassword())
                + ", " + rd.getUserName());

        String pass = String.valueOf(rd.getPassword());
        String userName = rd.getUserName();

        JOptionPane.showMessageDialog(this, userName + "\n" + pass);

    }//GEN-LAST:event_btnRegisterDialogActionPerformed

    private void btnInputDialog2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInputDialog2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnInputDialog2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Windows look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Windows (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Dialog().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnInputDialog;
    private javax.swing.JButton btnInputDialog2;
    private javax.swing.JButton btnRegisterDialog;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}
